package com.yl.chainStore.payrule.order

import com.baomidou.mybatisplus.annotation.EnumValue
import com.fasterxml.jackson.annotation.JsonValue
import com.yl.chainStore.payrule.order.entity.DefaultOrderRule
import com.yl.chainStore.payrule.order.entity.OrderFullMoneySendMoneyRule

enum class OrderRuleTypeEnum(@EnumValue val code: Int, @JsonValue val typeName: String, val clazz:Class<out OrderRule>) {

	ORDER_FULL_MONEY_SEND_MONEY(1,"满减优惠",OrderFullMoneySendMoneyRule::class.java),

	DEFAULT(99,"默认", DefaultOrderRule::class.java);

	companion object {
		fun getEnum(d: Int?): OrderRuleTypeEnum {
			return values()
				.find { it.code == (d ?: return DEFAULT) } ?: DEFAULT
		}
	}
}
